home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0058_Disk Ready Function.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-26  |  1KB  |  37 lines

  1. {
  2. From: PHIL NICKELL
  3. Subj: Disk Ready Function
  4.  
  5.  Here are a couple of ways that are about equivalent.  Which you use
  6.  depends on the info you might want about the drive.  These calls
  7.  actually spin up the disk and get info from the boot sector or the fat
  8.  table, so they also incidentally check if the disk is ready and ok.
  9.  Unfortunately, DOS doesn't really have a reasonable way to tell you if
  10.  the disk is ready without it actually spinning up the drive.
  11. }
  12.   var r:registers;
  13.  
  14.     Get Allocation Table Info
  15.   ...on entry
  16.          r.ah := $1ch;
  17.          r.dl := drivenum;  { 0=default, 1=A, 2=B etc}
  18.          msdos(r);
  19.   ...on return
  20.          r.al = sectors per cluster
  21.          r.cx = bytes per physical sector
  22.          r.dx = clusters per disk
  23.          ds:bx = pointer to media descriptor byte
  24.  
  25.      Get Free Disk Space Info
  26.   ...on entry
  27.          r.ah := $36;
  28.          r.dl := drivenum;  { 0=default, 1=A, 2=B etc}
  29.          msdos(r);
  30.   ...on return
  31.          r.ax = sectors per cluster /or/
  32.               = $ffff if error.
  33.          r.bx = number of available clusters
  34.          r.cx = bytes per sector
  35.            dx = clusters on the drive
  36.  
  37.